﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class NewBehaviourScript : MonoBehaviour {

	public int A;
	public float B;
	public double C;
	public GameObject go;
	public string str;
	public GameObject prefab;
	public Material mat;
	[SerializeField]
	private Texture tex;

	float angle = 0;

	Color[] colorList = { Color.red, Color.blue, Color.cyan, Color.green };

	int index = 0;

	// Use this for initialization
	void Start () {

		InvokeRepeating ("ChangeColor", 100, 100);
		
	}
	
	// Update is called once per frame
	void Update () {
		//GameObject go = GameObject.Find ("Cube");

		angle += 1;
		if (go != null) go.transform.Rotate (new Vector3 (0, angle, 0));	
	}

	void OnGUI()
	{
		if (GUI.Button (new Rect (100, 100, 200, 300), "if you see me, say I'm good.")) {
			Application.Quit ();
		}
	}

	void ChangeColor()
	{
		GetComponent<MeshRenderer> ().material.color = NextColor ();
	}

	Color NextColor()
	{
		index++;

		if (index == colorList.Length)
			index = 0;

		return colorList [index];
	}
}
